
import {debounce} from "./utils";
import BackTop from 'content/backTop/BackTop'

export const itemListenerMixin = {
  mounted(){
    let newRefresh = debounce(this.$refs.scroll.refresh,100)
    this.itemImgListener = ()=>{newRefresh()}
    this.$bus.$on('ItemImageLoad',this.itemImgListener)
    console.log("我是混入");
  }
}

export const backTopMixin = {
  components: {
    BackTop
  },
  data() {
    return {
      isShowBackTop: false,
    }
  },
  methods: {
    backClick() {
      console.log('回到顶部');
      this.$refs.scroll.scrollTo(0,0);

    },
    listenShowBackTop(position) {
      this.isShowBackTop = -(position.y) > 1000
    }
  }
}
